'declaration area of CONSTANTS and VARIABLES Option Explicit 'tell the compiler to not allow double or redundant variables Const DeveloperName = "Holy Cross College of Calinan." 'set program caption or name to a GLOBAL constant named DEVELOPERNAME Const SMSServerCode = "GETCODEFROMSMSSERVERS" 'set SMS Server Code to a GLOBAL constant named SMSSERVERCODE Dim MainData As String 'declare a GLOBAL variable named MAINDATA for our database path/location Dim PageMargin As Long 'declare a GLOBAL variable named PAGEMARGIN for our outer screen margins Dim InnerMargin As Integer 'declare a GLOBAL variable named INNERMARGIN for our inner screen margins Dim OrigFormWidth As Long 'declare a GLOBAL variable named ORIGFORMWIDTH for our original form/window width Dim OrigFormHeight As Long 'declare a GLOBAL variable named ORIGFORMHEIGHT for our original form/window height Dim MainDatabase As Database 'declare a GLOBAL variable named MAINDATABASE for our database object Dim StudentInfoRecordset As Recordset 'declare a GLOBAL variable named STUDENTINFORECORDSET for our Student Information Records Dim StudentBillRecordset As Recordset 'declare a GLOBAL variable named STUDENTBILLRECORDSET for our Student Billing Records Dim SMSInfoRecordset As Recordset 'declare a GLOBAL variable named SMSINFORECORDSET for our SMS Information Records Dim SMSBillRecordset As Recordset 'declare a GLOBAL variable named SMSBILLRECORDSET for our SMSM Billing Records Dim TempStringValue As String 'declare a GLOBAL variable named TEMPSTRINGVALUE for our temporary string or text values Dim TempSMSMessage As String 'declare a GLOBAL variable named TEMPSMSMESSAGE for our temporary SMS messages Dim Counter As Integer 'declare a GLOBAL variable named COUNTER for our FOR LOOP procedures Dim SearchIndex As Long 'declare a GLOBAL variable named SEARCHINDEX for recording the last record pointer in our database 'GLOBAL means this variable or constant can be used in ALL function and procedures Private Sub Form_Load() 'this event sub-procedure called LOAD is triggered everytime our form or window named FORM1 is loaded upon runtime or by calling the LOAD procedure On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If App.PrevInstance = True Then: End 'check if the app is already loaded or running, if TRUE then END this instance MainData = App.Path & "\MainData.MDB" 'assign the path of our database to MAINDATA variable If Dir(MainData) = "" Then: CreateOurDatabase 'check if path exists, if not then call procedure CREATEOURDATABASE to create a new database Data1.DatabaseName = MainData 'assign the value of variable MAINDATA to our data control no. 1 linked which is linked to grid/table no. 1 Data2.DatabaseName = MainData 'assign the value of variable MAINDATA to our data control no. 2 linked which is linked to grid/table no. 2 Set MainDatabase = OpenDatabase(MainData) 'open the database using the MAINDATA path/value and set MAINDATABASE as the controller object Set SMSInfoRecordset = MainDatabase.OpenRecordset("SELECT * FROM StudentRecord ORDER BY IDNo") 'set the recordset from the MAINDATABASE control using the SQL command and set SMSINFORECORDSET as the controller object Set SMSBillRecordset = MainDatabase.OpenRecordset("SELECT * FROM TableOfBill WHERE SMSDate<=Now And SMSCount<=0 ORDER BY Months, SMSDate") 'set the recordset from the MAINDATABASE control using the SQL command and set SMSBILLRECORDSET as the controller object SearchIndex = SMSBillRecordset.AbsolutePosition 'set the absolute position of our record pointer to SEARCHINDEX variable InitializeAllObjects 'call the INITIALIZEOBJECTS sub-procedure, to initialize our controls, the ones that will display on the screen after loading End Sub 'this END SUB statement ends the triggered LOAD event of our form or window named FORM1 Private Sub Form_Activate() 'this event sub-procedure called ACTIVATE is triggered after our form or window named FORM1 is activated upon runtime or by calling the SHOW procedure On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Option1_Click 0 'trigger the OPTION1 click event, and specify to use the object whose INDEX = 0 End Sub 'this END SUB statement ends the triggered ACTIVATE event of our form or window named FORM1 Private Sub Form_Resize() 'this event sub-procedure called RESIZE is triggered everytime we resize our form or windows using the mouse or by clicking the mimimize or maximize buttons On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Form1.WindowState <> 1 Then 'using IF statement, check if the current state of our window is not minimized (0=NORMAL, 1=MINIMIZED, 2=MAXIMIZED) then, If Form1.Width < OrigFormWidth Then 'using IF THEN ELSE statement, if the current width of our form or window is less than the value of ORIGFORMWIDTH then, Form1.Width = OrigFormWidth 'set the width of our form or window equal to the value of ORIGFORMWIDTH ElseIf Form1.Height < OrigFormHeight Then 'else, if the condition above is not met, check if the current height of our form or window is less than the value of ORIGFORMHEIGHT then, Form1.Height = OrigFormHeight 'set the height of our form or window equal to the value of ORIGFORMHEIGHT End If 'close our IF THEN ELSE statement using the END IF statement 'move or place the Command3 button whose INDEX = 0 supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Command3(0).Move Option1(0).Left + Option1(0).Width + PageMargin, PageMargin, Form1.Width - (Option1(0).Left + Option1(0).Width + (PageMargin * 3 + 60)), 500 If Command3.Count > 1 Then 'if the number of Command3 button loaded is greater than 1 then, 'move or place the Command3 button whose INDEX = 1 supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Command3(1).Move Command3(0).Left, Command3(0).Top, (Command3(0).Width * 0.7), Command3(0).Height 'move or place the Command3 button whose INDEX = 2 supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Command3(2).Move Command3(1).Left + Command3(1).Width, Command3(1).Top, (Command3(0).Width * 0.3), Command3(1).Height End If 'close our IF THEN ELSE statement using the END IF statement 'move or place the DBGRID1 button supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls DBGrid1.Move Command3(0).Left, Command3(0).Top + Command3(0).Height, Command3(0).Width, Form1.Height - (Command3(0).Top + Command3(0).Height + (PageMargin * 4)) 'set the width of the Columns whose INDEX = 0 of the DBGRID1 object with the resulting value of the supplied formula DBGrid1.Columns(0).Width = (DBGrid1.Width - (DBGrid1.Columns(2).Width + DBGrid1.Columns(3).Width + DBGrid1.Columns(4).Width + 300)) * 0.55 'set the width of the Columns whose INDEX = 1 of the DBGRID1 object with the resulting value of the supplied formula DBGrid1.Columns(1).Width = (DBGrid1.Width - (DBGrid1.Columns(2).Width + DBGrid1.Columns(3).Width + DBGrid1.Columns(4).Width + 300)) * 0.45 'move or place the DBGRID2 button supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls DBGrid2.Move DBGrid1.Left, DBGrid1.Top, DBGrid1.Width, DBGrid1.Height 'set the width of the Columns whose INDEX = 5 of the DBGRID2 object with the resulting value of the supplied formula DBGrid2.Columns(5).Width = (DBGrid2.Width - (DBGrid2.Columns(0).Width + DBGrid2.Columns(1).Width + DBGrid2.Columns(2).Width + DBGrid2.Columns(3).Width + DBGrid2.Columns(4).Width + DBGrid2.Columns(6).Width + DBGrid2.Columns(7).Width + 300)) 'move or place the Frame2 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Frame2.Move DBGrid1.Left + ((DBGrid1.Width \ 2) - ((Text2(0).Width + (PageMargin * 2)) \ 2)), DBGrid1.Top + ((DBGrid1.Height \ 2) - ((Command2(1).Top + Command2(1).Height + PageMargin + 1000) \ 2)), Text2(0).Width + (PageMargin * 2), Command2(1).Top + Command2(1).Height + PageMargin 'if Option1 control whose INDEX = 0 is selected then, move or place the Frame1 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls If Option1(0).Value = True Then: Frame1.Move DBGrid1.Left + ((DBGrid1.Width \ 2) - (Frame1.Width \ 2)), DBGrid1.Top + ((DBGrid1.Height \ 2) - ((Command1(1).Top + Command1(1).Height + PageMargin + 1000) \ 2)), Option1(0).Width, Command1(1).Top + Command1(1).Height + PageMargin 'move or place the TEXT3 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Text3.Move DBGrid1.Left, DBGrid1.Top, DBGrid1.Columns(0).Width, 260 'set the screen placement of TEXT3 object, in connection to other objects, ON TOP of the other objects Text3.ZOrder 0 'move or place the TEXT4 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Text4.Move PageMargin, Check1.Top + Check1.Height, Check1.Width, Form1.Height - (Check1.Top + Check1.Height + (PageMargin * 4)) End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered RESIZE event of our form or window named FORM1 Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) 'this event sub-procedure called KEYDOWN is triggered everytime a KEY is pressed down using the keyboard, it captures the values of parameters KEYCODE (the code of the pressed key) and the SHIFT (the code of CTRL, ALT or SHIFT) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Select Case KeyCode 'using SELECT CASE statement, test the value of parameter KEYCODE Case vbKeyF1 'check if the KEY pressed has a KEYCODE equal to the constant vbKeyF1 (F1 Key of the keyboard) If Command3(0).Enabled Then: Command3_Click 0 'if Command3 button whose INDEX=0 is enabled, then call Command3 Event Sub Procedure CLICK using the INDEX=0 Case vbKeyF2 'check if the KEY pressed has a KEYCODE equal to the constant vbKeyF2 (F2 Key of the keyboard) If Frame2.Visible = True And Command2(0).Enabled = True Then: Command2_Click 0 'if Frame2 object is visible and Command2 button whose INDEX=0 is enabled, then call Command2 Event Sub Procedure CLICK using the INDEX=0 Case vbKeyF3 'check if the KEY pressed has a KEYCODE equal to the constant vbKeyF3 (F3 Key of the keyboard) If Frame1.Visible = True And Command1(0).Enabled = True Then: Command1_Click 0 'if Frame1 object is visible and Command1 button whose INDEX=0 is enabled, then call Command2 Event Sub Procedure CLICK using the INDEX=0 Case vbKeyF5 'check if the KEY pressed has a KEYCODE equal to the constant vbKeyF5 (F5 Key of the keyboard) If DBGrid2.Visible = True Then: Command3_Click 1 'if DBGrid2 object is visible, then call Command3 Event Sub Procedure CLICK using the INDEX=1 Case vbKeyEscape 'check if the KEY pressed has a KEYCODE equal to the constant vbKeyEscape (ESCAPE Key of the keyboard) KeyCode = 0 'set the KEYCODE=0 to reset the code and prevent continuous triggering of the ESCAPE command If DBGrid2.Visible = True Then 'if DBGRID2 object is visible, then Command3_Click 2 'call Command3 Event Sub-Procedure CLICK using the INDEX=2 ElseIf Frame2.Visible = True Then 'if Frame2 object is visible, then Command2_Click 1 'call Command2 Event Sub-Procedure CLICK using the INDEX=1 ElseIf Frame1.Visible = True And Option1(0).Value = True Then 'if Frame1 object is visible, then Command1_Click 1 'call Command1 Event Sub-Procedure CLICK using the INDEX=1 Else 'if none of the conditions above are met, then Unload Form1 'unload this form or window named FORM1 End If 'close our IF THEN ELSE statement using the END IF statement End Select 'close our SELECT CASE statement using the END SELECT statement End Sub 'this END SUB statement ends the triggered KEYDOWN event of our form or window named FORM1 Private Sub Form_Unload(Cancel As Integer) 'this event sub-procedure called UNLOAD is triggered everytime our form or window named FORM1 is unloaded by calling the UNLOAD procedure On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If MsgBox("Do you really want to QUIT this system?", 36, DeveloperName) = vbYes Then 'using the built-in Message Box function(ask user if he wants to QUIT and unload Value, 36=Question Mark Icon,Caption of Message Box equal to value of DEVELOPERNAME), get the user's answer... If YES then, MainDatabase.Close 'close our MAINDATABASE controller object Data1.Database.Close 'close our data control no. 1 Data2.Database.Close 'close our data control no. 2 End 'END our program and EXIT to Windows desktop Else 'else, if answer is NO Cancel = -1 'cancel unloading by setting the value of Cancel equal to negative 1 End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered UNLOAD event of our form or window named FORM1 Private Sub Option1_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the OPTION1 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the OPTION1 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Form1.Visible = True Then 'using IF statement, check if our form named FORM1 is visible then, If Index = 1 Then 'using IF THEN ELSE statement, check if the index identifier of the OPTION1 object array is equal to 1 then, If Frame2.Visible = False Then 'using IF THEN ELSE statement, check if the Frame2 object is NOT visible then, Combo1(0).Enabled = True 'set the ENABLED properties of COMBO1 object array whose INDEX=0 to TRUE Combo1(1).Enabled = (Combo1(0).ListIndex > 0) 'set the ENABLED properties of COMBO1 object array whose INDEX=1 to (TRUE if the value of the LISTINDEX property of COMBO1(0) is greater than zero) Combo1(2).Enabled = (Combo1(1).ListIndex > 0) 'set the ENABLED properties of COMBO1 object array whose INDEX=2 to (TRUE if the value of the LISTINDEX property of COMBO1(1) is greater than zero) Else 'if Frame2 object is visible then, Combo1(0).Enabled = False 'set the ENABLED properties of COMBO1 object array whose INDEX=0 to False Combo1(1).Enabled = False 'set the ENABLED properties of COMBO1 object array whose INDEX=1 to False Combo1(2).Enabled = False 'set the ENABLED properties of COMBO1 object array whose INDEX=2 to False End If 'close our IF THEN ELSE statement using the END IF statement Option1(1).Move PageMargin, Option1(0).Top + Option1(0).Height 'move or place the OPTION1 object whose INDEX=1 supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Frame3.Move PageMargin + 270, Option1(1).Top + Option1(1).Height 'move or place the Frame3 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Frame1.Move PageMargin, Frame3.Top + Frame3.Height + PageMargin, Option1(0).Width, Combo1(2).Top + Combo1(2).Height + PageMargin 'move or place the Frame1 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Frame1.Caption = " FILTER Selection " 'set Frame1 caption to " FILTER Selection " Frame1.Visible = True 'set the VISIBLE property of Frame1 object to TRUE Text1(0).Enabled = False 'set the ENABLED property of Text1 whose INDEX=0 to FALSE Text1(1).Enabled = False 'set the ENABLED property of Text1 whose INDEX=1 to FALSE Text1(2).Enabled = False 'set the ENABLED property of Text1 whose INDEX=2 to FALSE Command1(0).Enabled = False 'set the ENABLED property of Command1 whose INDEX=0 to FALSE Command1(1).Enabled = False 'set the ENABLED property of Command1 whose INDEX=1 to FALSE Check1.Move PageMargin, Frame1.Top + Frame1.Height + PageMargin, Option1(0).Width 'move or place the Check1 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Else 'else, if the index identifier of the OPTION1 object array is NOT equal to 1 then, Combo1(0).Enabled = False 'set the ENABLED property of Combo1 object whose INDEX=0 to FALSE Combo1(1).Enabled = False 'set the ENABLED property of Combo1 object whose INDEX=1 to FALSE Combo1(2).Enabled = False 'set the ENABLED property of Combo1 object whose INDEX=2 to FALSE Frame3.Move PageMargin + 270, Option1(0).Top + Option1(0).Height 'move or place the Frame3 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Frame1.Visible = False 'set the VISIBLE property of Frame1 object to FALSE Option1(1).Move PageMargin, Frame3.Top + Frame3.Height + InnerMargin + 120 'move or place the OPTION1 object whose INDEX=1 supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls Check1.Move PageMargin, Option1(1).Top + Option1(1).Height + PageMargin, Option1(0).Width 'move or place the CHECK1 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls End If 'close our IF THEN ELSE statement using the END IF statement Text4.Move PageMargin, Check1.Top + Check1.Height, Check1.Width, Form1.Height - (Check1.Top + Check1.Height + (PageMargin * 4)) 'move or place the TEXT4 object supplying the parameters LEFT, TOP, WIDTH, HEIGHT with the values of the supplied values/objects/controls DisplayRecords "", 0 'call the DISPLAYRECORDS Sub-Procedure supplying the parameters FINDIDNO="", GRIDCOLDINDEX=0 End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered CLICK event of our object array named OPTION1 Private Sub Option3_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the OPTION3 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the OPTION3 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Form1.Visible Then: DisplayRecords "", 0 'using IF statement, check if our form named FORM1 is visible then, call the DISPLAYRECORDS Sub Procedure supplying the parameters FINDIDNO="", GRIDCOLINDEX=0 End Sub 'this END SUB statement ends the triggered CLICK event of our object array named OPTION3 Private Sub Combo1_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the COMBO1 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the COMBO1 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Form1.Visible Then 'using IF statement, check if our form named FORM1 is visible then, If Combo1(Index).ListIndex > 0 Then 'using IF THEN ELSE statement, check if the LISTINDEX value of the COMBO1 object array, whose INDEX=Index identifier, is greater than zero then, Combo1(Index).ForeColor = vbBlack 'set the FORECOLOR property of COMBO1 whose INDEX=Index Identfier to the constant vbBlack (BLACK) Else 'else, if the LISTINDEX value of the COMBO1 object array, whose INDEX=Index identifier, is NOT greater than zero then, Combo1(Index).ForeColor = vbRed 'set the FORECOLOR property of COMBO1 whose INDEX=Index Identfier to the constant vbRed (RED) End If 'close our IF THEN ELSE statement using the END IF statement Select Case Index 'using SELECT CASE statement, check the value of the Index Identifier Parameter Case 0 'if value of Index Identifier=0 If Combo1(0).ListIndex > 0 Then 'using IF THEN ELSE statement, check if the LISTINDEX value of COMBO1 object array, whose INDEX=0, is greater than zero then, If Combo1(1).Enabled = False Then 'using IF statement, check if the ENABLED property of COMBO1 object array whose INDEX=1 is equal to FALSE then, Combo1(1).ListIndex = 0 'set LISTINDEX value of COMBO1 object array whose INDEX=1 to ZERO Combo1(1).Enabled = True 'set ENABLED property of COMBO1 object array whose INDEX=1 to TRUE End If 'close our IF THEN statement using the END IF statement Else 'else, if the LISTINDEX value of COMBO1 object array, whose INDEX=0, is NOT greater than zero then, Combo1(1).ListIndex = 0 'set LISTINDEX value of COMBO1 object array whose INDEX=1 to ZERO Combo1(1).Enabled = False 'set ENABLED property of COMBO1 object array whose INDEX=1 to FALSE Combo1(2).ListIndex = 0 'set LISTINDEX value of COMBO1 object array whose INDEX=2 to ZERO Combo1(2).Enabled = False 'set ENABLED property of COMBO1 object array whose INDEX=2 to FALSE End If 'close our IF THEN ELSE statement using the END IF statement Case 1 'if value of Index Identifier=0 If Combo1(1).ListIndex > 0 Then 'using IF THEN ELSE statement, check if the LISTINDEX value of COMBO1 object array, whose INDEX=1, is greater than zero then, If Combo1(2).Enabled = False Then 'using IF statement, check if the ENABLED property of COMBO1 object array whose INDEX=2 is equal to FALSE then, Combo1(2).ListIndex = 0 'set LISTINDEX value of COMBO1 object array whose INDEX=2 to ZERO Combo1(2).Enabled = True 'set ENABLED property of COMBO1 object array whose INDEX=2 to TRUE End If 'close our IF THEN statement using the END IF statement Else 'else, if the LISTINDEX value of COMBO1 object array, whose INDEX=1, is NOT greater than zero then, Combo1(2).ListIndex = 0 'set LISTINDEX value of COMBO1 object array whose INDEX=2 to ZERO Combo1(2).Enabled = False 'set ENABLED property of COMBO1 object array whose INDEX=2 to FALSE End If 'close our IF THEN ELSE statement using the END IF statement End Select 'close our SELECT CASE statement using the END SELECT statement If Option1(0).Value = False Then: DisplayRecords "", 0 'using IF statement, check if the value of our object named OPTION1, whose INDEX=0, is FALSE then, call the DISPLAYRECORDS Sub Procedure supplying the parameters FINDIDNO="", GRIDCOLINDEX=0 End If 'close our IF THEN statement using the END IF statement End Sub 'this END SUB statement ends the triggered CLICK event of our object array named COMBO1 Private Sub Check1_Click() 'this event sub-procedure called CLICK is triggered everytime the CHECK1 object is clicked by the mouse On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Check1.Value = 1 Then 'using IF THEN ELSE statement, check if the value of the CHECK1 object, is equal to 1 then, Timer1.Interval = 15000 'set INTERVAL value of TIMER1 object equal to 15000 or every 15 seconds Text4.Text = Text4.Text & "Automatic SMS is now Activated and will trigger every " & IIf(Timer1.Interval > 0, Timer1.Interval / 1000, 0) & " second(s)." & vbCrLf & vbCrLf 'set TEXT value of TEXT4 object Else 'else, if the value of CHECK1 object NOT equal to 1 then, Timer1.Interval = 0 'set INTERVAL value of TIMER1 object equal to 0 or DISABLE Text4.Text = Text4.Text & "Automatic SMS is now De-Activated." & vbCrLf & vbCrLf 'set TEXT value of TEXT4 object End If 'close our IF THEN ELSE statement using the END IF statement Text4.SelStart = Len(Text4.Text) 'set the keyboard CURSOR at the end of the length of the TEXT4 value End Sub 'this END SUB statement ends the triggered CLICK event of our object named CHECK1 Private Sub Command3_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the Command3 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the Command3 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim TempYear As String 'declare a LOCAL variable named TEMPYEAR for our YEAR PERIOD Dim TempGrade As String 'declare a LOCAL variable named TEMPGRADE for our GRADE NAME Dim TempSection As String 'declare a LOCAL variable named TEMPSECTION for our SECTION NAME Dim TempAmount As Double 'declare a LOCAL variable named TEMPAMOUNT for our SMS FEE AMOUNT 'LOCAL means this variable or constant can be used ONLY here in this sub procedure Select Case Index 'using SELECT CASE statement, check the value of the Index Identifier Parameter Case 0 'if value of Index Identifier=0 For Counter = 0 To 4 'using FOR NEXT LOOP statement using the variable COUNTER to loop 5 times starting from 0 to 4 Text2(Counter).Text = "" 'set the TEXT value of object named Text2, whose INDEX=the value of COUNTER, equal to "" Next Counter 'loop adding 1 to the current value of Counter Command2(0).Caption = "SAVE NEW STUDENT = F2" 'set the CAPTION property of Command2 object array, whose INDEX=0 Frame2.Caption = " ADD a New Student " 'set the CAPTION property of Frame2 object Frame2.Visible = True 'set the VISIBLE property of Frame2 object equal to TRUE Frame2.ZOrder 0 'set the screen placement of Frame2 object, in connection to other objects, ON TOP of the other objects Text2(0).SetFocus 'set the FOCUS to Text2 object, whose INDEX=0 DisableControls 'call the DISABLECONTROLS sub-procedure Case 1 'if value of Index Identifier=1 EnterDueDate: 'set a breakpoint ENTERDUEDATE to be used by the GOTO statement Data2.Refresh 'Refresh Data2 control to its latest database records If Data2.Recordset.RecordCount > 0 Then 'using IF THEN ELSE statement, check if the Data2 record count is greater than zero then, Data2.Recordset.MoveLast 'move the record pointer to the last record TempStringValue = InputBox("Enter NEW Due Date:" & vbCrLf & vbCrLf & "Format: MM/DD/YYYY", DeveloperName, Format(DateAdd("m", 1, Data2.Recordset!Months), "mm/dd/yyyy")) 'using the built-in Input Box function(ask user of NEW DUE DATE value, Box Caption=Developername, default value = value of the current Months Field + 1 using the DateAdd function, and assign its value to the TEMPSTRING VALUE variable Else 'else, if the Data2 record count is NOT greater than zero then, TempStringValue = InputBox("Enter NEW Due Date:" & vbCrLf & vbCrLf & "Format: MM/DD/YYYY", DeveloperName, Format(DateAdd("m", 1, Date), "mm/dd/yyyy")) 'using the built-in Input Box function(ask user of NEW DUE DATE value, Box Caption=Developername, default value = value of the current Date + 1 using the DateAdd function, and assign its value to the TEMPSTRING VALUE variable End If 'close our IF THEN ELSE statement using the END IF statement If TempStringValue = "" Then: Exit Sub 'if variable TEMPSTRINGVALUE="" then, EXIT this CLICK sub-procedure of the Command3 object array If Not IsDate(TempStringValue) Then 'using IF THEN ELSE statement, check if the value of variable TEMPSTRINGVALUE is NOT a valid DATE value then, MsgBox "Only DATE values are allowed here.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) GoTo EnterDueDate 'go to the above breakpoint named ENTERDUEDATE Else 'else, if the value of variable TEMPSTRINGVALUE is a VALID date then, TempYear = Data2.Recordset!YearName & "" 'assign the current YEARNAME field value of the Data2 control to variable TEMPYEAR TempGrade = Data2.Recordset!GradeName & "" 'assign the current GRADENAME field value of the Data2 control to variable TEMPGRADE TempSection = Data2.Recordset!SectionName & "" 'assign the current SECTIONNAME field value of the Data2 control to variable TEMPSECTION TempAmount = Data2.Recordset!AmountFee 'assign the current AMOUNTFEE field value of the Data2 control to variable TEMPAMOUNT Data2.Recordset.AddNew 'set the Data2 control to accept NEW records Data2.Recordset!Months = CDate(TempStringValue) 'set Data2 control MONTHS field value equal to the value of the variable TEMPSTRINGVALUE Data2.Recordset!IDNo = Data1.Recordset!IDNo 'set Data2 control IDNO field value equal to the value of the DATA1 control IDNO field value Data2.Recordset!SMSDate = Format(CDate(TempStringValue), "mm/dd/yyyy 09:00:00") 'set Data2 control SMSDate field value equal to the value of the variable TEMPSTRINGVALUE using the format mm/dd/yyyy 09:00:00 Data2.Recordset!YearName = TempYear 'set Data2 control TEMPYEAR field value equal to the value of the DATA1 control TEMPYEAR field value Data2.Recordset!GradeName = TempGrade 'set Data2 control TEMPGRADE field value equal to the value of the DATA1 control TEMPGRADE field value Data2.Recordset!SectionName = TempSection 'set Data2 control TEMPSECTION field value equal to the value of the DATA1 control TEMPSECTION field value Data2.Recordset!AmountFee = TempAmount 'set Data2 control TEMPAMOUNT field value equal to the value of the DATA1 control TEMPAMOUNT field value Data2.Recordset.Update 'set the Data2 control to UPDATE its records to the NEW added fields CalculateBill CDate(TempStringValue) 'call the CALCULATEBILL sub-procedure supplying the parameter MONTHNOW=value of variable TEMPSTRINGVALUE End If 'close our IF THEN ELSE statement using the END IF statement Case 2 'if value of Index Identifier=2 EnableControls 'call the ENABLECONTROLS sub-procedure DisplayRecords Data1.Recordset!IDNo, 2 'call the DISPLAYRECORDS sub-procedure supplying the paramters IDNO=value of the current IDNO field of Data1 control,GRIDCOLDINDEX=0 End Select 'close our SELECT CASE statement using the END SELECT statement End Sub 'this END SUB statement ends the triggered CLICK event of our object array named Command3 Private Sub Command2_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the Command2 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the Command2 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Index = 0 Then 'using IF THEN ELSE statement, check if the index identifier of the Command2 object array is equal to 0 then, For Counter = 0 To 4 'using FOR NEXT LOOP statement using the variable COUNTER to loop 5 times starting from 0 to 4 If Text2(Counter).Text = "" Then 'using IF statement, check if the TEXT value of Text2 object array whose INDEX=value of COUNTER is equal to "" then, MsgBox Label2(Counter).Caption & " Field should not be empty.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Text2(Counter).SetFocus 'set the FOCUS to Text2 object, whose INDEX=value of COUNTER Exit Sub 'EXIT this CLICK sub-procedure of the Command2 object array End If 'close our IF THEN statement using the END IF statement Next Counter 'loop adding 1 to the current value of Counter If Len(Text2(4).Text) <> 11 Then 'using IF THEN ELSE statement, check if the length of the TEXT value of Text2 object array whose INDEX=4 is NOT equal to 11 then, MsgBox "Please Enter a Valid Cellphone Number.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Text2(4).SetFocus 'set the FOCUS to Text2 object, whose INDEX=4 Else 'else, if length of the TEXT value of Text2 object array whose INDEX=4 is EQUAL to 11 then, SaveOrUpdateStudent (Command2(0).Caption = "UPDATE STUDENT = F2") 'call SAVEORUPDATESTUDENT sub-procedure supplying the parameter THISISANUPDATE=TRUE if the caption of Command2 object, whose INDEX=0, is equal to "UPDATE STUDENT = F2", otherwise, THISISANUPDATE=FALSE End If 'close our IF THEN ELSE statement using the END IF statement Else 'else, if the index identifier of the Command2 object array is NOT equal to 0 then, EnableControls 'call ENABLECONTROLS sub-procedure DisplayRecords Data1.Recordset!IDNo, 3 'call DISPLAYRECORDS sub-procedure supplying the parameters FINDIDNO=value of IDNO field of the Data1 object,GRIDCOLINDEX=3 End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered CLICK event of our object array named Command2 Private Sub Command1_Click(Index As Integer) 'this event sub-procedure called CLICK is triggered everytime the Command1 object array is clicked by the mouse, it captures the values of parameter INDEX (the index identifier of the Command1 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Index = 0 Then 'using IF THEN ELSE statement, check if the index identifier of the Command1 object array is equal to 0 then, If Combo1(0).ListIndex > 0 And Combo1(1).ListIndex > 0 And Combo1(2).ListIndex > 0 Then 'using IF statement, check if the LISTINDEX value of COMBO1 object array, whose indexes=0,1 and 2, is greater than zero then, If CDbl(Text1(1).Text) < 1 Or CDbl(Text1(1).Text) > 12 Then 'using IF statement, check if the TEXT value of Text1 object array, whose index=1, is less than 1 or greater than 12 then, MsgBox "Only NUMERIC values [1 to 12] are allowed here.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Text1(1).SetFocus 'set the FOCUS to Text1 object, whose INDEX=1 Exit Sub 'EXIT this CLICK sub-procedure of the Command1 object array End If 'close our IF THEN statement using the END IF statement If CDbl(Text1(2).Text) <= 0 Or CDbl(Text1(2).Text) > 99999 Then 'using IF statement, check if the TEXT value of Text1 object array, whose index=2, is less than or equal to zero or greater than 99999 then, MsgBox "Only NUMERIC values [0.01 to 99,999.00] are allowed here.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Text1(2).SetFocus 'set the FOCUS to Text1 object, whose INDEX=2 Exit Sub 'EXIT this CLICK sub-procedure of the Command1 object array End If 'close our IF THEN statement using the END IF statement TempStringValue = Data1.Recordset!IDNo 'assign the current value of IDNO field of DATA1 control to the variable TEMPSTRINGVALUE Set StudentBillRecordset = MainDatabase.OpenRecordset("SELECT * FROM TableOfBill WHERE IDNo='" & Data1.Recordset!IDNo & "' And YearName='" & Trim(Combo1(0).Text) & "'") 'set the recordset from the MAINDATABASE control using the SQL command and set SMSBILLRECORDSET as the controller object If StudentBillRecordset.RecordCount > 0 Then 'using IF THEN ELSE statement, check if the record count of the STUDENTBILLRECORDSET object is greater than zero then, If MsgBox("Notice!!!" & vbCrLf & vbCrLf & Trim(Combo1(0).Text) & vbCrLf & vbCrLf & "Billing Record of" & vbCrLf & vbCrLf & Data1.Recordset!datafield1 & vbCrLf & vbCrLf & "...already existed. Do you want to Display it instead?", 36, DeveloperName) = vbYes Then 'using the built-in Message Box function(message, 36=Question Mark Icon,Caption of Message Box equal to value of DEVELOPERNAME), get the user's answer... If YES then, Option1(1).Value = True 'set the value of OPTION1 object array, whose INDEX=1, to TRUE Combo1(1).ListIndex = 0 'set the LISTINDEX value of the COMBO1 object array, whose INDEX=1, to ZERO Data1.Recordset.FindFirst "IDNo='" & TempStringValue & "' And YearName='" & StudentBillRecordset!YearName & "' And GradeName='" & StudentBillRecordset!GradeName & "' And SectionName='" & StudentBillRecordset!SectionName & "'" 'find the first occurence of IDNO field in DATA1 control whose IDNO=value of variable TEMPSTRINGVALUE, YearName=value of the current YEARNAME of StudentBillRecordset object, GradeName=value of the current GRADENAME of StudentBillRecordset object, SectionName=value of the current SECTIONNAME of StudentBillRecordset object If Not Data1.Recordset.NoMatch Then: DBGrid1_ButtonClick 2 'if the result of the search has no match then, call DBGRID1 Event Sub-Procedure BUTTONCLICK using the INDEX=2 End If 'close our IF THEN statement using the END IF statement Else 'else, if the record count of the STUDENTBILLRECORDSET object is NOT greater than zero then, For Counter = 0 To CInt(Text1(1).Text) - 1 'using FOR NEXT LOOP statement using the variable COUNTER to loop Nth times starting from 0 to the value of Text1 object minus 1, whose INDEX=1, StudentBillRecordset.AddNew 'set the STUDENTBILLRECORDSET control to accept NEW records StudentBillRecordset!Months = DateAdd("m", Counter, CDate(Text1(0).Text)) 'set STUDENTBILLRECORDSET control MONTHS field value equal to the TEXT value (PLUS 1 month using dateadd) of Text1 object array, whose INDEX=0 StudentBillRecordset!IDNo = Data1.Recordset!IDNo 'set STUDENTBILLRECORDSET control IDNO field value equal to the value of the DATA1 control IDNO field value StudentBillRecordset!SMSDate = Format(DateAdd("m", Counter, CDate(Text1(0).Text)), "mm/dd/yyyy 09:00:00") 'set STUDENTBILLRECORDSET control SMSDate field value equal to the value of the variable TEMPSTRINGVALUE (PLUS 1 month) using the format mm/dd/yyyy 09:00:00 StudentBillRecordset!YearName = Trim(Combo1(0).Text) 'set STUDENTBILLRECORDSET control YEARNAME field value equal to the TEXT value of COMBO1 object array, whose INDEX=0 StudentBillRecordset!GradeName = Trim(Combo1(1).Text) 'set STUDENTBILLRECORDSET control GRADENAME field value equal to the TEXT value of COMBO1 object array, whose INDEX=1 StudentBillRecordset!SectionName = Trim(Combo1(2).Text) 'set STUDENTBILLRECORDSET control SECTIONNAME field value equal to the TEXT value of COMBO1 object array, whose INDEX=2 StudentBillRecordset!AmountFee = CDbl(Text1(2).Text) 'set STUDENTBILLRECORDSET control AMOUNTFEE field value equal to the TEXT value of Text1 object array, whose INDEX=2 StudentBillRecordset.Update 'set the STUDENTBILLRECORDSET control to UPDATE its records to the NEW added fields Next Counter 'loop adding 1 to the current value of Counter Data2.RecordSource = "SELECT TableOfBill.*,'' as Adds,'' as DeleteButton FROM TableOfBill WHERE TableOfBill.IDNo='" & Data1.Recordset!IDNo & "' And ucase(TableOfBill.YearName)='" & UCase(Trim(Combo1(0).Text)) & "' And ucase(TableOfBill.GradeName)='" & UCase(Trim(Combo1(1).Text)) & "' And ucase(TableOfBill.SectionName)='" & UCase(Trim(Combo1(2).Text)) & "' ORDER BY Months,SMSDate" 'set the RECORDSOURCE of Data2 control to the supplied SQL statement CalculateBill CDate(Date) 'call the CALCULATEBILL sub-procedure supplying the parameter MONTHNOW=value of current DATE EnableControls 'call ENABLECONTROLS sub-procedure Frame1.Visible = False 'set the VISIBLE property of Frame1 object equal to FALSE Option1(1).Value = True 'set the value of OPTION1 object to TRUE Data1.Recordset.FindFirst "IDNo='" & TempStringValue & "'" 'find the first occurence of IDNO field in DATA1 control whose IDNO=value of variable TEMPSTRINGVALUE DBGrid1_ButtonClick 2 'call DBGRID1 Event Sub Procedure BUTTONCLICK using the INDEX=2 End If 'close our IF THEN ELSE statement using the END IF statement Else If Combo1(0).ListIndex = 0 Then 'using IF THEN ELSE statement, check if the LISTINDEX value of COMBO1, whose INDEX=0, is equal to ZERO then, MsgBox "Please Select a Year Period.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Combo1(0).SetFocus 'set the FOCUS to COMBO1 object, whose INDEX=0 ElseIf Combo1(1).ListIndex = 0 Then 'else, check if the LISTINDEX value of COMBO1, whose INDEX=1, is equal to ONE then, MsgBox "Please Select a Grade.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Combo1(1).SetFocus 'set the FOCUS to COMBO1 object, whose INDEX=1 Else 'if none of the conditions above are met, then MsgBox "Please Select a Section.", 48, DeveloperName 'call MSGBOX procedure to display (message,48=ALERT ICON,Caption of Message Box equal to value of DEVELOPERNAME) Combo1(2).SetFocus 'set the FOCUS to COMBO1 object, whose INDEX=2 End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Else 'else, if the index identifier of the Command1 object array is NOT equal to 0 then, EnableControls 'call ENABLECONTROLS sub-procedure Frame1.Visible = False 'set the VISIBLE property of Frame1 object to FALSE DBGrid1.SetFocus 'set the FOCUS to DBGRID1 object DBGrid1.Col = 2 'FOCUS the pointer to COLUMN number 2 of the DBGRID1 object End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered CLICK event of our object array named Command1 Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer) 'this event sub-procedure called BUTTONCLICK is triggered everytime the column buttons of DBGRID1 object array is clicked by the mouse, it captures the values of parameter COLINDEX (the column index identifier of the DBGRID1 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Select Case ColIndex 'using SELECT CASE statement, check the value of the Column Index Identifier Parameter Case 2 'if value of Column Index Identifier=2 If Option1(0).Value = True Then DisableControls Combo1(0).Enabled = True Combo1(1).Enabled = (Combo1(0).ListIndex > 0) Combo1(2).Enabled = (Combo1(1).ListIndex > 0) Frame1.Move DBGrid1.Left + ((DBGrid1.Width \ 2) - (Frame1.Width \ 2)), DBGrid1.Top + ((DBGrid1.Height \ 2) - ((Command1(1).Top + Command1(1).Height + PageMargin + 1000) \ 2)), Option1(0).Width, Command1(1).Top + Command1(1).Height + PageMargin Frame1.Caption = " Billing Creator " Frame1.Visible = True Text1(0).Enabled = True Text1(1).Enabled = True Text1(2).Enabled = True Command1(0).Enabled = True Command1(1).Enabled = True Frame1.ZOrder 0 Combo1(0).SetFocus Else BackHereNow: Data2.RecordSource = "SELECT TableOfBill.*,'' as Adds,'' as DeleteButton FROM TableOfBill WHERE TableOfBill.IDNo='" & Data1.Recordset!IDNo & "' And ucase(TableOfBill.YearName)='" & UCase(Data1.Recordset!YearName) & "' And ucase(TableOfBill.GradeName)='" & UCase(Data1.Recordset!GradeName) & "' And ucase(TableOfBill.SectionName)='" & UCase(Data1.Recordset!SectionName) & "' ORDER BY Months,SMSDate" Data2.Refresh If Data2.Recordset.RecordCount > 0 Then DBGrid2.Caption = Data1.Recordset!LastName & ", " & Data1.Recordset!FirstName & " (" & Data1.Recordset!MiddleName & ")" & " - Guardian: " & Data1.Recordset!ParentName DBGrid2.Columns(5).Caption = "Schedule to Send" & vbCrLf & "a Text Message to" & vbCrLf & Data1.Recordset!ContactNo Data2.Recordset.FindFirst "Months>=datevalue('" & Date & "')" DisableControls Command3(1).Visible = True Command3(1).ZOrder Command3(2).Visible = True Command3(2).ZOrder DBGrid2.Visible = True DBGrid2.ZOrder 0 DBGrid2.SetFocus Else Option1(0).Value = True End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Case 3 'if value of Column Index Identifier=3 DisableControls Text2(0).Text = Data1.Recordset!LastName & "" Text2(1).Text = Data1.Recordset!FirstName & "" Text2(2).Text = Data1.Recordset!MiddleName & "" Text2(3).Text = Data1.Recordset!ParentName & "" Text2(4).Text = Data1.Recordset!ContactNo & "" If Data1.Recordset!Gender = "MALE" Then Option2(0).Value = True Else Option2(1).Value = True End If 'close our IF THEN ELSE statement using the END IF statement Frame2.Caption = " EDIT this Student " Command2(0).Caption = "UPDATE STUDENT = F2" Frame2.Visible = True Frame2.ZOrder 0 Text2(0).SetFocus Case 4 'if value of Column Index Identifier=4 If Option1(0).Value = True Then If MsgBox("Do you really want to DELETE ALL" & vbCrLf & "Student Records (Including Billing) of:" & vbCrLf & vbCrLf & Data1.Recordset!datafield1 & "?", 36, DeveloperName) = vbYes Then MainDatabase.Execute "Delete * FROM TableOfBill WHERE IDNo='" & Data1.Recordset!IDNo & "'" MainDatabase.Execute "Delete * FROM StudentRecord WHERE IDNo='" & Data1.Recordset!IDNo & "'" DisplayRecords "", 4 End If 'close our IF THEN statement using the END IF statement Else If MsgBox("Do you really want to DELETE" & vbCrLf & "this particular Billing Record of:" & vbCrLf & vbCrLf & Data1.Recordset!datafield1 & vbCrLf & vbCrLf & Data1.Recordset!DataField2 & "?", 36, DeveloperName) = vbYes Then MainDatabase.Execute "Delete * FROM TableOfBill WHERE IDNo='" & Data1.Recordset!IDNo & "' And YearName='" & Data1.Recordset!YearName & "' And GradeName='" & Data1.Recordset!GradeName & "' And SectionName='" & Data1.Recordset!SectionName & "'" DisplayRecords Data1.Recordset!IDNo, 4 End If 'close our IF THEN statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement End Select 'close our SELECT CASE statement using the END SELECT statement End Sub Private Sub DBGrid2_ButtonClick(ByVal ColIndex As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Select Case ColIndex Case 0 BackHere1: TempStringValue = InputBox("Enter NEW Recorded Due Date:" & vbCrLf & vbCrLf & "Format: MM/DD/YYYY", DeveloperName, Format(DBGrid2.Columns(0).Text, "mm/dd/yyyy")) If TempStringValue = "" Then: Exit Sub If Not IsDate(TempStringValue) Then MsgBox "Only DATE values are allowed here.", 48, DeveloperName GoTo BackHere1 Else DBGrid2.Columns(0).Text = CDate(TempStringValue) Data2.UpdateRecord CalculateBill DBGrid2.Columns(0).Text DBGrid2.Col = ColIndex End If 'close our IF THEN ELSE statement using the END IF statement Case 1 BackHere2: TempStringValue = InputBox("Enter NEW SMS Fee:", DeveloperName, Format(DBGrid2.Columns(1).Text, "#,###,##0.00")) If TempStringValue = "" Then: Exit Sub If Not IsNumeric(TempStringValue) Then MsgBox "Only NUMERIC values [0 to 99,999] are allowed here.", 48, DeveloperName GoTo BackHere2 Else If CDbl(TempStringValue) < 0 Or CDbl(TempStringValue) > 99999 Then MsgBox "Only NUMERIC values [0 to 99,999] are allowed here.", 48, DeveloperName GoTo BackHere2 Else DBGrid2.Columns(1).Text = CDbl(TempStringValue) Data2.UpdateRecord CalculateBill DBGrid2.Columns(0).Text DBGrid2.Col = ColIndex End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Case 4 BackHere3: TempStringValue = InputBox("Enter NEW Payment Received:", DeveloperName, Format(DBGrid2.Columns(4).Text, "#,###,##0.00")) If TempStringValue = "" Then: Exit Sub If Not IsNumeric(TempStringValue) Then MsgBox "Only NUMERIC values [0 to 9,999,999] are allowed here.", 48, DeveloperName GoTo BackHere3 Else If CDbl(TempStringValue) < 0 Or CDbl(TempStringValue) > 9999999 Then MsgBox "Only NUMERIC values [0 to 9,999,999] are allowed here.", 48, DeveloperName GoTo BackHere3 Else DBGrid2.Columns(4).Text = CDbl(TempStringValue) Data2.UpdateRecord CalculateBill DBGrid2.Columns(0).Text DBGrid2.Col = ColIndex End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Case 5 BackHere4: TempStringValue = InputBox("Enter NEW SMS Schedule Date:" & vbCrLf & vbCrLf & "Format: MM/DD/YYYY", DeveloperName, Format(DBGrid2.Columns(5).Text, "mm/dd/yyyy")) If TempStringValue = "" Then: Exit Sub If Not IsDate(TempStringValue) Then MsgBox "Only DATE values are allowed here.", 48, DeveloperName GoTo BackHere4 Else BackHere5: TempStringValue = InputBox("Enter NEW SMS Schedule Time:" & vbCrLf & vbCrLf & "24 Hour Format: HH:MM:SS", DeveloperName, Format(DBGrid2.Columns(5).Text, "hh:mm:ss")) If TempStringValue = "" Then: Exit Sub If Not IsDate(TempStringValue) Then MsgBox "Only TIME values are allowed here.", 48, DeveloperName GoTo BackHere5 Else DBGrid2.Columns(5).Text = Format(CDate(TempStringValue), "mm/dd/yyyy") & " " & Format(CDate(TempStringValue), "hh:mm:ss") Data2.UpdateRecord DBGrid2.Col = ColIndex End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Case 6 If MsgBox("Do you really want to Send an SMS to:" & vbCrLf & vbCrLf & " " & Data1.Recordset!ParentName & vbCrLf & vbCrLf & " ...thru Cell No. " & Data1.Recordset!ContactNo & "?", 36, DeveloperName) = vbYes Then TempSMSMessage = "Hi! Mr./Ms. " & Trim(Data1.Recordset!ParentName) & ". We would like to inform you that the date of your child's exam will be on " & Format(Data2.Recordset!Months, "mm/dd/yyyy") & ". Please be reminded to settle your account of P" & Format(Data2.Recordset!CurrentBill, "#,###,##0.00") & " on or before " & Format(Data2.Recordset!Months, "mm/dd/yyyy") & ". If you have some queries, please contact HCCC at 295-0797. Have a blessed day! - Researchers from HCCC" Text4.BackColor = vbRed DoEvents TempStringValue = SendSMSMessage(Data1.Recordset!ContactNo, TempSMSMessage, SMSServerCode) If TempStringValue = "Success! SMS Message is now on queue and" & vbCrLf & "will be sent as soon as possible by HCCC." Then Data2.Recordset.Edit Data2.Recordset!SMSCount = Data2.Recordset!SMSCount + 1 Data2.Recordset.Update End If 'close our IF THEN statement using the END IF statement Text4.BackColor = vbWhite MsgBox TempStringValue, 64, DeveloperName End If 'close our IF THEN statement using the END IF statement Case 7 If MsgBox("Do you really want to DELETE:" & vbCrLf & vbCrLf & " Recorded Due Date:" & DBGrid2.Columns(0).Text & vbCrLf & " Amount Due:" & DBGrid2.Columns(3).Text & vbCrLf & " Payment Received:" & DBGrid2.Columns(4).Text & "?", 36, DeveloperName) = vbYes Then Data2.Recordset.Delete Data2.Refresh If Data2.Recordset.RecordCount > 0 Then CalculateBill Date DBGrid2.Col = ColIndex Else EnableControls DisplayRecords Data1.Recordset!IDNo, 2 End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN statement using the END IF statement End Select 'close our SELECT CASE statement using the END SELECT statement End Sub Private Sub Text2_GotFocus(Index As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Text2(Index).BackColor = vbYellow Text2(Index).SelStart = 0 Text2(Index).SelLength = Len(Text2(Index).Text) End Sub Private Sub Text2_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) 'this event sub-procedure called KEYDOWN is triggered everytime the Text2 object array is PRESSED DOWN, it captures the values of parameter INDEX (the index identifier of the Text2 object) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then 'using IF THEN ELSE statement, check if the value of parameter KEYCODE is equal to constant vbKeyReturn (keyboard ENTER KEY) or vbKeyDown (keyboard DOWN ARROW) then, If Index < (Text2.Count - 1) Then 'using IF THEN ELSE statement, check if the Index Identifier is less than the value, of the total object count of the Text2 object array then, Text2(Index + 1).SetFocus 'set the FOCUS to Text2 object, whose INDEX=Indexer Identifier PLUS ONE Else 'else, if the Index Identifier is NOT less than the value, of the total object count of the Text2 object array then, Text2(0).SetFocus 'set the FOCUS to Text2 object, whose INDEX=0 End If 'close our IF THEN ELSE statement using the END IF statement ElseIf KeyCode = vbKeyUp Then 'else, if the value of parameter KEYCODE is equal to constant vbKeyUp (keyboard UP ARROW) then, If Index > 0 Then 'using IF THEN ELSE statement, check if the Index Identifier is greater than ZERO then, Text2(Index - 1).SetFocus 'set the FOCUS to Text2 object, whose INDEX=Index Identifier MINUS ONE Else 'else, if the Index Identifier is NOT greater than ZERO then, Text2(Text2.Count - 1).SetFocus 'set the FOCUS to Text2 object, whose INDEX=Total Object Count of the Text2 object array MINUS ONE End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement End Sub 'this END SUB statement ends the triggered KEYDOWN event of our object array named Text2 Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer) 'this event sub-procedure called KEYPRESS is triggered everytime the Text2 object array is PRESSED, it captures the values of parameter INDEX (the index identifier of the Text2 object), and KEYASCII (the ASCII value of the KEY that was pressed) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Index = 4 Then 'using IF statement, check if the value of Index Identifier is equal to 4 then, Select Case KeyAscii Case 44, 46, 48 To 57, 8 'do nothing Case Else KeyAscii = 0 'set the value of KEYASCII to 0 End Select 'close our SELECT CASE statement using the END SELECT statement End If 'close our IF THEN statement using the END IF statement End Sub 'this END SUB statement ends the triggered KEYPRESS event of our object array named Text2 Private Sub Text2_LostFocus(Index As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Text2(Index).Text = Trim(UCase(Replace(Text2(Index).Text, "'", "`"))) Text2(Index).BackColor = vbWhite End Sub Private Sub Text1_GotFocus(Index As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Select Case Index Case 0 If IsDate(Text1(0).Text) Then: Text1(0).Text = Format(Text1(0).Text, "mm/dd/yyyy") Case 1 If IsNumeric(Text1(1).Text) Then: Text1(1).Text = Format(Text1(1).Text, "0") Case 2 If IsNumeric(Text1(2).Text) Then: Text1(2).Text = Format(Text1(2).Text, "0.00") End Select 'close our SELECT CASE statement using the END SELECT statement Text1(Index).BackColor = vbYellow Text1(Index).SelStart = 0 Text1(Index).SelLength = Len(Text1(Index).Text) End Sub Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then If Index < (Text1.Count - 1) Then Text1(Index + 1).SetFocus Else Text1(0).SetFocus End If 'close our IF THEN ELSE statement using the END IF statement ElseIf KeyCode = vbKeyUp Then If Index > 0 Then Text1(Index - 1).SetFocus Else Text1(Text1.Count - 1).SetFocus End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement End Sub Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Index = 1 Or Index = 2 Then Select Case KeyAscii Case 44, 46, 48 To 57, 8 'do nothing Case Else KeyAscii = 0 End Select 'close our SELECT CASE statement using the END SELECT statement End If 'close our IF THEN statement using the END IF statement End Sub Private Sub Text1_LostFocus(Index As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Text1(Index).Text = Trim(UCase(Replace(Text1(Index).Text, "'", "`"))) Text1(Index).BackColor = vbWhite Select Case Index Case 0 If IsDate(Text1(0).Text) Then Text1(0).Text = Format(Text1(0).Text, "mmmm d, yyyy") Else Text1(0).Text = Format(Date, "mmmm d, yyyy") End If 'close our IF THEN ELSE statement using the END IF statement Case 1 If IsNumeric(Text1(1).Text) Then Text1(1).Text = Format(Text1(1).Text, "0") Else Text1(1).Text = "0" End If 'close our IF THEN ELSE statement using the END IF statement Case 2 If IsNumeric(Text1(2).Text) Then Text1(2).Text = Format(Text1(2).Text, "#,###,##0.00") Else Text1(2).Text = "0.00" End If 'close our IF THEN ELSE statement using the END IF statement End Select 'close our SELECT CASE statement using the END SELECT statement End Sub Private Sub Text3_Change() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Form1.Visible Then If Data1.Recordset.RecordCount > 0 Then Data1.Recordset.FindFirst "DataField1 Like '*" & Trim(UCase(Replace(Text3.Text, "'", "`"))) & "*' Or DataField2 Like '*" & Trim(UCase(Replace(Text3.Text, "'", "`"))) & "*'" End If 'close our IF THEN statement using the END IF statement End If 'close our IF THEN statement using the END IF statement End Sub Private Sub Text3_GotFocus() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Text3.Text = "" Then: Text3.Text = "" Text3.BackColor = vbYellow Text3.SelStart = 0 Text3.SelLength = Len(Text3.Text) End Sub Private Sub Text3_LostFocus() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Text3.Text = "" Text3.BackColor = vbWhite End Sub Private Sub Timer1_Timer() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point If Timer1.Interval > 0 Then If (SearchIndex = SMSBillRecordset.AbsolutePosition) Then SearchIndex = -1 'reset SearchIndex SMSBillRecordset.FindFirst "SMSDate<=Now And SMSCount<=0" 'find first occurence Else SearchIndex = SMSBillRecordset.AbsolutePosition 'Set SearchIndex to AbsolutePosition SMSBillRecordset.FindNext "SMSDate<=Now And SMSCount<=0" 'find next occurence End If 'close our IF THEN ELSE statement using the END IF statement If Not SMSBillRecordset.NoMatch Then SMSInfoRecordset.FindFirst "IDNo='" & SMSBillRecordset!IDNo & "'" If Not SMSInfoRecordset.NoMatch Then TempSMSMessage = "Hi! Mr./Ms. " & Trim(SMSInfoRecordset!ParentName) & ". We would like to inform you that the date of your child's exam will be on " & Format(SMSBillRecordset!Months, "mm/dd/yyyy") & ". Please be reminded to settle your account of P" & Format(SMSBillRecordset!CurrentBill, "#,###,##0.00") & " on or before " & Format(SMSBillRecordset!Months, "mm/dd/yyyy") & ". If you have some queries, please contact HCCC at 295-0797. Have a blessed day! - Researchers from HCCC" Text4.BackColor = vbRed If Len(Text4.Text) > 20000 Then Text4.Text = "SMS log is cleared and refreshed." & vbCrLf & vbCrLf Else Text4.Text = Text4.Text & "Connecting to SMS Server..." & vbCrLf & vbCrLf End If 'close our IF THEN ELSE statement using the END IF statement Text4.SelStart = Len(Text4.Text) Check1.Enabled = False DoEvents TempStringValue = SendSMSMessage(SMSInfoRecordset!ContactNo, TempSMSMessage, SMSServerCode) If TempStringValue = "Success! SMS Message is now on queue and" & vbCrLf & "will be sent as soon as possible by HCCC." Then SMSBillRecordset.Edit SMSBillRecordset!SMSCount = 1 SMSBillRecordset.Update Data2.UpdateRecord DBGrid2.Refresh Text4.Text = Text4.Text & "Successfully sent SMS to " & SMSInfoRecordset!ParentName & " at Cell #: " & SMSInfoRecordset!ContactNo & " for P" & Format(SMSBillRecordset!AmountFee, "#,###,##0.00") & " Amount Due on " & Format(SMSBillRecordset!Months, "mm/dd/yyyy") & "." & vbCrLf & vbCrLf Else Text4.Text = Text4.Text & "Failed sending an SMS to " & SMSInfoRecordset!ParentName & " at Cell #: " & SMSInfoRecordset!ContactNo & " for P" & Format(SMSBillRecordset!AmountFee, "#,###,##0.00") & " Amount Due on " & Format(SMSBillRecordset!Months, "mm/dd/yyyy") & " for this reason: " & TempStringValue & vbCrLf & vbCrLf End If 'close our IF THEN ELSE statement using the END IF statement Text4.BackColor = vbWhite Text4.SelStart = Len(Text4.Text) Check1.Enabled = True Else SMSInfoRecordset.Requery End If 'close our IF THEN ELSE statement using the END IF statement Else SMSBillRecordset.Requery SearchIndex = SMSBillRecordset.AbsolutePosition End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN statement using the END IF statement End Sub Private Sub CreateOurDatabase() On Error GoTo CloseSystem Dim StudentTable As TableDef, BillTable As TableDef Dim StudentField(1 To 7) As Field, BillField(1 To 11) As Field Dim SchoolDatabase As Database Set SchoolDatabase = CreateDatabase(MainData, dbLangGeneral, dbEncrypt) Set StudentTable = SchoolDatabase.CreateTableDef("StudentRecord") Set BillTable = SchoolDatabase.CreateTableDef("TableOfBill") Set StudentField(1) = StudentTable.CreateField("IDNo", dbText, 10) Set StudentField(2) = StudentTable.CreateField("LastName", dbText, 50) Set StudentField(3) = StudentTable.CreateField("FirstName", dbText, 50) Set StudentField(4) = StudentTable.CreateField("MiddleName", dbText, 50) Set StudentField(5) = StudentTable.CreateField("ParentName", dbText, 150) Set StudentField(6) = StudentTable.CreateField("ContactNo", dbText, 50) Set StudentField(7) = StudentTable.CreateField("Gender", dbText, 10) Set BillField(1) = BillTable.CreateField("IDNo", dbText, 10) Set BillField(2) = BillTable.CreateField("Months", dbDate) Set BillField(3) = BillTable.CreateField("AmountFee", dbDouble) Set BillField(4) = BillTable.CreateField("SMSDate", dbDate) Set BillField(5) = BillTable.CreateField("BalanceBill", dbDouble) Set BillField(6) = BillTable.CreateField("CurrentBill", dbDouble) Set BillField(7) = BillTable.CreateField("PaidAmount", dbDouble) Set BillField(8) = BillTable.CreateField("YearName", dbText, 50) Set BillField(9) = BillTable.CreateField("GradeName", dbText, 50) Set BillField(10) = BillTable.CreateField("SectionName", dbText, 50) Set BillField(11) = BillTable.CreateField("SMSCount", dbInteger) For Counter = 1 To 7 'using FOR NEXT LOOP statement using the variable COUNTER to loop 7 times starting from 1 to 7 StudentField(Counter).DefaultValue = """""" StudentField(Counter).AllowZeroLength = True StudentTable.Fields.Append StudentField(Counter) Next Counter 'loop adding 1 to the current value of Counter For Counter = 1 To 11 'using FOR NEXT LOOP statement using the variable COUNTER to loop 11 times starting from 1 to 11 Select Case Counter Case 1, 8, 9, 10 BillField(Counter).DefaultValue = """""" BillField(Counter).AllowZeroLength = True Case 2, 4 BillField(Counter).DefaultValue = "Date()" Case Else BillField(Counter).DefaultValue = 0 End Select 'close our SELECT CASE statement using the END SELECT statement BillTable.Fields.Append BillField(Counter) Next Counter 'loop adding 1 to the current value of Counter SchoolDatabase.TableDefs.Append StudentTable SchoolDatabase.TableDefs.Append BillTable Exit Sub CloseSystem: MsgBox Error(Err), 48, DeveloperName End End Sub 'in this Sub Procedure we will initialize all the objects that we will display on screen 'the option buttons, check buttons, command buttons, text and labels, table grids and other controls Private Sub InitializeAllObjects() 'we will call this procedure as InitializeAllObjects On Error Resume Next 'tell the compiler to ignore all errors so that our program will not exit abruptly if errors are encountered Form1.Caption = " Holy Cross College of Calinan SMS-Billing System" Form1.Width = Screen.Width * 0.85 Form1.Height = Screen.Height * 0.8 OrigFormWidth = Form1.Width OrigFormHeight = Form1.Height PageMargin = 180 InnerMargin = 90 Form1.KeyPreview = True Form1.BackColor = &HC0C0C0 'first we will, set the background color of our FORM to Gray 'Option1(0) is the 1st Option Button with Index = 0 Option1(0).Move PageMargin, PageMargin, 3400, 285 'this button is moved to: Left Position, Top Position, Width of Button, Height of Button Option1(0).Font = "Verdana" 'set it's Font to VERDANA Option1(0).Font.Bold = True 'set it's Font to BOLD Option1(0).BackColor = Form1.BackColor 'set it's background color equal to our MAIN FORM's color w/c is gray Option1(0).Caption = "CREATE BILLING RECORDS" 'set it's caption Load Option1(1) 'we now load the 2nd option button with index = 1 Option1(1).Caption = "DISPLAY BILLING RECORDS" 'set it's caption Option1(1).Visible = True 'make it visible to user Option1(0).Value = True Check1.Font = "Verdana" Check1.Font.Size = 9 Check1.Caption = "Automate Sending of SMS" Check1.BackColor = Form1.BackColor Check1.Visible = True Data1.Visible = False DBGrid1.Visible = True DBGrid1.HeadFont.Size = 11 DBGrid1.Font.Size = 11 DBGrid1.HeadFont.Name = "Verdana" DBGrid1.HeadFont.Bold = True DBGrid1.HeadFont.Size = 10 DBGrid1.Font.Name = "Verdana" DBGrid1.Font.Bold = False DBGrid1.Font.Size = 9 DBGrid1.HeadLines = 4 DBGrid1.RowHeight = (240 * 3) DBGrid1.MarqueeStyle = 4 DBGrid1.RecordSelectors = False DBGrid1.AllowAddNew = False DBGrid1.AllowArrows = True DBGrid1.AllowDelete = False DBGrid1.AllowUpdate = False DBGrid1.BackColor = &H8000000F DBGrid1.Columns(0).Caption = " Last Name, First Name (Middle Name)" & vbCrLf & " School Year (Gender)" & vbCrLf & " Grade-Section" DBGrid1.Columns(0).DataField = "DataField1" DBGrid1.Columns(0).Locked = True DBGrid1.Columns(0).AllowSizing = True DBGrid1.Columns(0).WrapText = True DBGrid1.Columns(0).Button = False DBGrid1.Columns(0).Alignment = 0 DBGrid1.Columns(1).Caption = " Student Number" & vbCrLf & " Name of Guardian" & vbCrLf & " Contact Number" DBGrid1.Columns(1).DataField = "DataField2" DBGrid1.Columns(1).Locked = True DBGrid1.Columns(1).AllowSizing = True DBGrid1.Columns(1).WrapText = True DBGrid1.Columns(1).Button = False DBGrid1.Columns(1).Alignment = 0 DBGrid1.Columns(2).Caption = "Click The" & vbCrLf & "Drop Down" & vbCrLf & "Button To" DBGrid1.Columns(2).DataField = "BillButton" DBGrid1.Columns(2).Locked = True DBGrid1.Columns(2).AllowSizing = False DBGrid1.Columns(2).WrapText = True DBGrid1.Columns(2).Button = True DBGrid1.Columns(2).Alignment = 2 DBGrid1.Columns(2).Width = 1500 DBGrid1.Columns(3).Caption = "Click The" & vbCrLf & "Drop Down" & vbCrLf & "Button To" DBGrid1.Columns(3).DataField = "EditButton" DBGrid1.Columns(3).Locked = True DBGrid1.Columns(3).AllowSizing = False DBGrid1.Columns(3).WrapText = True DBGrid1.Columns(3).Button = True DBGrid1.Columns(3).Alignment = 2 DBGrid1.Columns(3).Width = 1500 DBGrid1.Columns(4).Caption = "Click The" & vbCrLf & "Drop Down" & vbCrLf & "Button To" DBGrid1.Columns(4).DataField = "DeleteButton" DBGrid1.Columns(4).Locked = True DBGrid1.Columns(4).AllowSizing = False DBGrid1.Columns(4).WrapText = True DBGrid1.Columns(4).Button = True DBGrid1.Columns(4).Alignment = 2 DBGrid1.Columns(4).Width = 1500 Frame1.Caption = " Billing Creator " Frame1.Font = "Verdana" Frame1.Font.Bold = True Frame1.Font.Size = 9 Frame1.BackColor = Form1.BackColor Label1(0).Font = "Verdana" Label1(0).Font.Bold = True Label1(0).Font.Size = 10 Label1(0).AutoSize = True Label1(0).BackStyle = 0 Label1(0).Caption = "Year Period" Label1(0).Move PageMargin, PageMargin * 2 Combo1(0).Font = "Verdana" Combo1(0).Font.Bold = True Combo1(0).Font.Size = 9 Combo1(0).AddItem " ALL PERIODS" Combo1(0).AddItem " YEAR 2019-2020" Combo1(0).AddItem " YEAR 2018-2019" Combo1(0).AddItem " YEAR 2017-2018" Combo1(0).AddItem " YEAR 2016-2017" Combo1(0).AddItem " YEAR 2015-2016" Combo1(0).AddItem " YEAR 2014-2015" Combo1(0).AddItem " YEAR 2013-2014" Combo1(0).AddItem " YEAR 2012-2013" Combo1(0).AddItem " YEAR 2011-2012" Combo1(0).AddItem " YEAR 2010-2011" Combo1(0).AddItem " YEAR 2009-2010" Combo1(0).ListIndex = 0 Combo1(0).ForeColor = vbRed Combo1(0).Move PageMargin, Label1(0).Top + Label1(0).Height, Option1(0).Width - (PageMargin * 2) Load Label1(1) Label1(1).Caption = "Grade" Label1(1).Move PageMargin, Combo1(0).Top + Combo1(0).Height + InnerMargin Label1(1).Visible = True Load Combo1(1) Combo1(1).AddItem " ALL GRADES" Combo1(1).AddItem " GRADE 1" Combo1(1).AddItem " GRADE 2" Combo1(1).AddItem " GRADE 3" Combo1(1).AddItem " GRADE 4" Combo1(1).AddItem " GRADE 5" Combo1(1).AddItem " GRADE 6" Combo1(1).AddItem " GRADE 7" Combo1(1).AddItem " GRADE 8" Combo1(1).AddItem " GRADE 9" Combo1(1).AddItem " GRADE 10" Combo1(1).AddItem " GRADE 11" Combo1(1).ListIndex = 0 Combo1(1).ForeColor = vbRed Combo1(1).Move PageMargin, Label1(1).Top + Label1(1).Height, Combo1(0).Width Combo1(1).Visible = True Load Label1(2) Label1(2).Caption = "Section" Label1(2).Move PageMargin, Combo1(1).Top + Combo1(1).Height + InnerMargin Label1(2).Visible = True Load Combo1(2) Combo1(2).AddItem " ALL SECTIONS" Combo1(2).AddItem " SECTION 1" Combo1(2).AddItem " SECTION 2" Combo1(2).AddItem " SECTION 3" Combo1(2).AddItem " SECTION 4" Combo1(2).AddItem " SECTION 5" Combo1(2).ListIndex = 0 Combo1(2).ForeColor = vbRed Combo1(2).Move PageMargin, Label1(2).Top + Label1(2).Height, Combo1(0).Width Combo1(2).Visible = True Load Label1(3) Label1(3).Caption = "First Due Date" Label1(3).Move PageMargin, Combo1(2).Top + Combo1(2).Height + PageMargin Label1(3).Visible = True Text1(0).Move PageMargin, Label1(3).Top + Label1(3).Height Text1(0).Font = "Verdana" Text1(0).Font.Bold = True Text1(0).Font.Size = 10 Text1(0).Width = Combo1(2).Width Text1(0).Alignment = 2 Text1(0).MaxLength = 20 Text1(0).Text = Format(Date, "mmmm d, yyyy") Text1(0).Visible = True Load Label1(4) Label1(4).Caption = "No. of Months to Pay" Label1(4).Move PageMargin, Text1(0).Top + Text1(0).Height + PageMargin Label1(4).Visible = True Load Text1(1) Text1(1).Move PageMargin, Label1(4).Top + Label1(4).Height Text1(1).Text = "6" Text1(1).Visible = True Load Label1(5) Label1(5).Caption = "SMS Fee" Label1(5).Move PageMargin, Text1(1).Top + Text1(1).Height + InnerMargin Label1(5).Visible = True Load Text1(2) Text1(2).Move PageMargin, Label1(5).Top + Label1(5).Height Text1(2).Text = "0.00" Text1(2).Visible = True Command1(0).Font = "Verdana" Command1(0).Font.Bold = True Command1(0).Font.Size = 10 Command1(0).Caption = "CREATE BILLING = F3" Command1(0).Move PageMargin, Text1(2).Top + Text1(2).Height + PageMargin, Text1(2).Width, 500 Load Command1(1) Command1(1).Caption = "CANCEL = ESC" Command1(1).Move PageMargin, Command1(0).Top + Command1(0).Height, Command1(0).Width, 500 Command1(1).Visible = True Data2.Visible = False DBGrid2.Visible = False DBGrid2.HeadFont.Size = 10 DBGrid2.Font.Size = 11 DBGrid2.HeadFont.Name = "Verdana" DBGrid2.HeadFont.Bold = True DBGrid2.HeadFont.Size = 9 DBGrid2.Font.Name = "Tahoma" DBGrid2.Font.Bold = False DBGrid2.Font.Size = 9 DBGrid2.HeadLines = 4 DBGrid2.RowHeight = 300 DBGrid2.AllowAddNew = False DBGrid2.AllowArrows = True DBGrid2.AllowDelete = False DBGrid2.AllowUpdate = False DBGrid2.MarqueeStyle = 4 DBGrid2.RecordSelectors = False DBGrid2.BackColor = &H8000000F DBGrid2.Columns(0).Caption = "Recorded" & vbCrLf & "Due Date" DBGrid2.Columns(0).DataField = "Months" DBGrid2.Columns(0).Locked = True DBGrid2.Columns(0).AllowSizing = False DBGrid2.Columns(0).WrapText = True DBGrid2.Columns(0).NumberFormat = "MMM-dd-yyyy" DBGrid2.Columns(0).Alignment = 2 DBGrid2.Columns(0).Width = 1650 DBGrid2.Columns(0).Button = True DBGrid2.Columns(1).Caption = "SMS " & vbCrLf & "Fee " DBGrid2.Columns(1).DataField = "AmountFee" DBGrid2.Columns(1).Locked = True DBGrid2.Columns(1).AllowSizing = False DBGrid2.Columns(1).NumberFormat = "#,###,##0.00" DBGrid2.Columns(1).Alignment = 1 DBGrid2.Columns(1).Width = 1350 DBGrid2.Columns(1).Button = True DBGrid2.Columns(2).Caption = "Previous " & vbCrLf & "Balance " DBGrid2.Columns(2).DataField = "BalanceBill" DBGrid2.Columns(2).Locked = True DBGrid2.Columns(2).AllowSizing = False DBGrid2.Columns(2).NumberFormat = "#,###,##0.00;(#,###,##0.00);" DBGrid2.Columns(2).Alignment = 1 DBGrid2.Columns(2).Width = 1350 DBGrid2.Columns(3).Caption = "Amount " & vbCrLf & "Due " DBGrid2.Columns(3).DataField = "CurrentBill" DBGrid2.Columns(3).Locked = True DBGrid2.Columns(3).AllowSizing = False DBGrid2.Columns(3).NumberFormat = "#,###,##0.00;(#,###,##0.00);" DBGrid2.Columns(3).Alignment = 1 DBGrid2.Columns(3).Width = 1350 DBGrid2.Columns(4).Caption = "Payment " & vbCrLf & "Received " DBGrid2.Columns(4).DataField = "PaidAmount" DBGrid2.Columns(4).Locked = True DBGrid2.Columns(4).AllowSizing = False DBGrid2.Columns(4).NumberFormat = "#,###,##0.00" DBGrid2.Columns(4).Alignment = 1 DBGrid2.Columns(4).Width = 1600 DBGrid2.Columns(4).Button = True DBGrid2.Columns(5).Caption = "Schedule to Send" & vbCrLf & "a Text Message to" & vbCrLf & "Cellphone #" DBGrid2.Columns(5).DataField = "SMSDate" DBGrid2.Columns(5).Locked = True DBGrid2.Columns(5).AllowSizing = False DBGrid2.Columns(5).NumberFormat = "mm/dd/yyyy hh:mm:ss AM/PM" DBGrid2.Columns(5).Alignment = 2 DBGrid2.Columns(5).Button = True DBGrid2.Columns(5).Width = 2800 DBGrid2.Columns(6).Caption = "# of" & vbCrLf & "SMS" & vbCrLf & "Sent" DBGrid2.Columns(6).DataField = "SMSCount" DBGrid2.Columns(6).Locked = True DBGrid2.Columns(6).AllowSizing = False DBGrid2.Columns(6).Button = True DBGrid2.Columns(6).NumberFormat = "#,##0" DBGrid2.Columns(6).Alignment = 2 DBGrid2.Columns(6).Width = 800 DBGrid2.Columns(7).Caption = "Click The" & vbCrLf & "Drop Down" & vbCrLf & "Button To" DBGrid2.Columns(7).DataField = "DeleteButton" DBGrid2.Columns(7).Locked = True DBGrid2.Columns(7).AllowSizing = False DBGrid2.Columns(7).Button = True DBGrid2.Columns(7).Alignment = 2 DBGrid2.Columns(7).Width = 1450 Frame2.BackColor = Form1.BackColor Frame2.Font = "Verdana" Frame2.Font.Bold = True Frame2.Font.Size = 10 Frame2.Visible = False Label2(0).Move PageMargin, (PageMargin * 2) Label2(0).Caption = "Last Name" Label2(0).Font = "Verdana" Label2(0).Font.Bold = True Label2(0).Font.Size = 10 Label2(0).AutoSize = True Label2(0).BackStyle = 0 Text2(0).Move PageMargin, Label2(0).Top + Label2(0).Height Text2(0).Font = "Verdana" Text2(0).Font.Bold = True Text2(0).Font.Size = 10 Text2(0).Width = (Option1(0).Width - (PageMargin * 2)) + 1000 Text2(0).MaxLength = 25 Text2(0).Text = "" Load Label2(1) Label2(1).Move PageMargin, Text2(0).Top + Text2(0).Height + InnerMargin Label2(1).Caption = "First Name" Label2(1).Visible = True Load Text2(1) Text2(1).Move PageMargin, Label2(1).Top + Label2(1).Height Text2(1).MaxLength = 25 Text2(1).Text = "" Text2(1).Visible = True Load Label2(2) Label2(2).Move PageMargin, Text2(1).Top + Text2(1).Height + InnerMargin Label2(2).Caption = "Middle Name" Label2(2).Visible = True Load Text2(2) Text2(2).Move PageMargin, Label2(2).Top + Label2(2).Height Text2(2).MaxLength = 25 Text2(2).Text = "" Text2(2).Visible = True Load Label2(3) Label2(3).Move PageMargin, Text2(2).Top + Text2(2).Height + InnerMargin Label2(3).Caption = "Guardian Name" Label2(3).Visible = True Load Text2(3) Text2(3).Move PageMargin, Label2(3).Top + Label2(3).Height Text2(3).MaxLength = 25 Text2(3).Text = "" Text2(3).Visible = True Load Label2(4) Label2(4).Move PageMargin, Text2(3).Top + Text2(3).Height + InnerMargin Label2(4).Caption = "Cellphone Number" Label2(4).Visible = True Load Text2(4) Text2(4).Move PageMargin, Label2(4).Top + Label2(4).Height Text2(4).MaxLength = 11 Text2(4).Text = "" Text2(4).Visible = True Option2(0).Move PageMargin, Text2(4).Top + Text2(4).Height + PageMargin, 1500 Option2(0).Font = "Verdana" Option2(0).Font.Bold = True Option2(0).Font.Size = 10 Option2(0).Caption = "MALE" Option2(0).BackColor = Form1.BackColor Load Option2(1) Option2(1).Move Option2(0).Left + Option2(0).Width, Text2(4).Top + Text2(4).Height + PageMargin Option2(1).Caption = "FEMALE" Option2(1).Visible = True Option2(0).Value = True Command2(0).Font = "Verdana" Command2(0).Font.Bold = True Command2(0).Font.Size = 10 Command2(0).Move PageMargin, Option2(0).Top + Option2(0).Height + PageMargin, Text2(0).Width Load Command2(1) Command2(1).Move PageMargin, Command2(0).Top + Command2(0).Height, Text2(0).Width Command2(1).Caption = "CANCEL = ESC" Command2(1).Visible = True Option3(0).Move PageMargin, PageMargin, 1800, 270 Option3(0).Font = "Verdana" Option3(0).BackColor = Form1.BackColor Option3(0).Caption = "BOTH GENDER" Load Option3(1) Option3(1).Move PageMargin, Option3(0).Top + Option3(0).Height, Option3(0).Width Option3(1).Caption = "MALE ONLY" Option3(1).Visible = True Load Option3(2) Option3(2).Move PageMargin, Option3(1).Top + Option3(1).Height, Option3(1).Width Option3(2).Caption = "FEMALE ONLY" Option3(2).Visible = True Option3(0).Value = True Frame3.Caption = "" Frame3.BackColor = Form1.BackColor Frame3.Width = Option3(2).Width + (PageMargin * 2) Frame3.Height = Option3(2).Top + Option3(2).Height + InnerMargin Frame3.Visible = True Command3(0).Font = "Verdana" Command3(0).Font.Bold = True Command3(0).Font.Size = 11 Command3(0).Caption = "ADD NEW STUDENT RECORD = F1" Load Command3(1) Command3(1).Caption = "Click this BUTTON to ADD a New Due Date = F5" Load Command3(2) Command3(2).Caption = "Hide Billing = ESC" Text3.Font = "Verdana" Text3.Font.Size = 8 Text3.Appearance = 0 Text3.Text = "" Text4.Font = "Verdana" Text4.Font.Size = 8 Text4.Appearance = 0 Text4.Locked = True Text4.Text = "SMS logbook is initialized." & vbCrLf & vbCrLf 'let's put our controls in order (who's first to get focus and gonna be next and so on) whenever they are visible and when we press TAB key in our keyboard Option1(0).TabIndex = 0 'CREATE BILLING RECORDS (option button) Option1(1).TabIndex = 1 'DISPLAY BILLING RECORDS (option button) Frame3.TabIndex = 2 'GENDER (frame) Option3(0).TabIndex = 3 'BOTH GENDER (option button) Option3(1).TabIndex = 4 'MALE ONLY (option button) Option3(2).TabIndex = 5 'FEMALE ONLY (option button) Frame1.TabIndex = 6 'FILTER SELECTION (frame) Combo1(0).TabIndex = 7 'YEAR PERIOD (combo box) Combo1(1).TabIndex = 8 'GRADE NAME (combo box) Combo1(2).TabIndex = 9 'SECTION NAME (combo box) Check1.TabIndex = 10 'AUTOMATE SENDING OF SMS (check box) Text4.TabIndex = 11 'SMS CHECK BOX (status text box) Command3(0).TabIndex = 12 'ADD NEW STUDENT = F1 (command button) Text3.TabIndex = 13 ' (text box) DBGrid1.TabIndex = 14 'LIST OF RECORDED STUDENTS/STUDENT INFORMATION (database grid/table) Command3(1).TabIndex = 15 'Click this BUTTON to ADD a New Due Date = F5 (command button) Command3(2).TabIndex = 16 'Hide Billing = ESC (command button)" DBGrid2.TabIndex = 17 'Billing/Recorded Due Date (database grid/table) Frame2.TabIndex = 18 'ADD/EDIT Student (frame) Text2(0).TabIndex = 19 'Last Name (text box) Text2(1).TabIndex = 20 'First Name (text box) Text2(2).TabIndex = 21 'Middle Name (text box) Text2(3).TabIndex = 22 'Guardian Name (text box) Text2(4).TabIndex = 23 'Cellphone Number (text box) Option2(0).TabIndex = 24 'MALE (option button) Option2(1).TabIndex = 25 'FEMALE (option button) Command2(0).TabIndex = 26 'SAVE/UPDATE NEW STUDENT = F2 (command button) Command2(1).TabIndex = 27 'CANCEL = ESC (command button) Text1(0).TabIndex = 28 'First Due Date (text box) Text1(1).TabIndex = 29 'No. of Months to Pay (text box) Text1(2).TabIndex = 30 'SMS Fee (text box) Command1(0).TabIndex = 31 'CREATE BILLING = F3 (command button) Command1(1).TabIndex = 32 'CANCEL = ESC (command button) Form1.Move (Screen.Width \ 2) - (Form1.Width \ 2), (Screen.Height \ 2) - (Form1.Height \ 2) End Sub Private Sub SaveOrUpdateStudent(ThisIsAnUpdate As Boolean) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim MyIDNo As String Set StudentInfoRecordset = MainDatabase.OpenRecordset("SELECT * FROM StudentRecord WHERE LastName+FirstName+MiddleName='" & Text2(0).Text & Text2(1).Text & Text2(2).Text & "'") If StudentInfoRecordset.RecordCount > 0 Then If (Command2(0).Caption = "SAVE NEW STUDENT = F2") Or (Command2(0).Caption = "UPDATE STUDENT = F2" And (Text2(0).Text & Text2(1).Text & Text2(2).Text <> Data1.Recordset!LastName & Data1.Recordset!FirstName & Data1.Recordset!MiddleName)) Then MsgBox "System can't save " & Text2(0).Text & ", " & Text2(1).Text & " (" & Text2(2).Text & ")." & vbCrLf & "This Student Name is already recorded in the database.", 48, DeveloperName Text2(0).SetFocus Exit Sub End If 'close our IF THEN statement using the END IF statement End If 'close our IF THEN statement using the END IF statement If ThisIsAnUpdate = True Then MyIDNo = Data1.Recordset!IDNo MainDatabase.Execute "Update StudentRecord Set " _ & "LastName = '" & Text2(0).Text & "', " _ & "FirstName = '" & Text2(1).Text & "', " _ & "MiddleName = '" & Text2(2).Text & "', " _ & "ParentName = '" & Text2(3).Text & "', " _ & "ContactNo = '" & Text2(4).Text & "', " _ & "Gender = '" & IIf(Option2(0).Value = True, "MALE", "FEMALE") & "' " _ & "WHERE IDNo = '" & Data1.Recordset!IDNo & "'" Else Set StudentInfoRecordset = MainDatabase.OpenRecordset("SELECT Top 1 Val(IDNo) as TempIDNo FROM StudentRecord ORDER BY Val(IDNo) Desc") If StudentInfoRecordset.RecordCount > 0 And Not IsNull(StudentInfoRecordset!TempIDNo) Then If Val(StudentInfoRecordset!TempIDNo) < 999999 Then MyIDNo = Format(Val(StudentInfoRecordset!TempIDNo) + 1, "000000") Else MyIDNo = "" End If 'close our IF THEN ELSE statement using the END IF statement Else MyIDNo = "000001" End If 'close our IF THEN ELSE statement using the END IF statement If MyIDNo = "" Then MsgBox "Error: The limit of 999,999 student records is reached.", 48, DeveloperName Else MainDatabase.Execute "Insert Into StudentRecord(IDNo, LastName, FirstName, MiddleName, ParentName, ContactNo, Gender) Values('" & MyIDNo _ & "','" & Text2(0).Text & "','" & Text2(1).Text & "','" & Text2(2).Text & "','" & Text2(3).Text & "','" & Text2(4).Text & "','" & IIf(Option2(0).Value = True, "MALE", "FEMALE") & "')" End If 'close our IF THEN ELSE statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement SMSInfoRecordset.Requery EnableControls If ThisIsAnUpdate = False Then: Option1(0).Value = True If Option3(0).Value = False Then 'not both gender Option3(1).Value = Option2(0).Value Option3(2).Value = Option2(1).Value End If 'close our IF THEN statement using the END IF statement DisplayRecords MyIDNo, 3 If ThisIsAnUpdate = False Then: DBGrid1_ButtonClick 2 End Sub Private Sub DisplayRecords(FindIDNo As String, GridColIndex As Integer) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim Field1 As String Dim Field2 As String Dim Field3 As String Dim Field4 As String Dim Field5 As String Dim GenderField As String Dim SortField As String Dim GenderFilter As String If Option3(0).Value = True Then GenderField = "(StudentRecord.Gender='MALE' Or StudentRecord.Gender='FEMALE')" GenderFilter = " " ElseIf Option3(1).Value = True Then GenderField = "(StudentRecord.Gender='MALE')" GenderFilter = " Male " ElseIf Option3(2).Value = True Then GenderField = "(StudentRecord.Gender='FEMALE')" GenderFilter = " Female " End If 'close our IF THEN ELSE statement using the END IF statement If Option1(0).Value = True Then DBGrid1.Columns(0).Caption = " List of Recorded STUDENTS" & vbCrLf & " Name and Gender" DBGrid1.Columns(1).Caption = " List of Recorded GUARDIANS" & vbCrLf & " Name and Cell No." Field1 = "' ' + StudentRecord.LastName + ', ' + StudentRecord.FirstName + ' (' + StudentRecord.MiddleName + ')' + Chr(10) + Chr(13) + ' Gender: ' + StudentRecord.Gender" Field2 = "' ' + StudentRecord.ParentName + Chr(10)+ Chr(13) + ' Cell No.: ' + StudentRecord.ContactNo" Field3 = "'' + Chr(10) + Chr(13) + 'NEW' + Chr(10) + Chr(13) + 'BILLING'" Field4 = "'' + Chr(10) + Chr(13) + 'THIS' + Chr(10) + Chr(13) + 'RECORD'" Field5 = "'' + Chr(10) + Chr(13) + 'THIS' + Chr(10) + Chr(13) + 'RECORD'" SortField = "StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName" Data1.RecordSource = "SELECT DISTINCT " & Field1 & " as DataField1, " & Field2 & " as DataField2, " & Field3 & " as BillButton, " & Field4 & " as EditButton, " & Field5 & " as DeleteButton, StudentRecord.IDNo, StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, StudentRecord.ParentName, StudentRecord.ContactNo, StudentRecord.Gender FROM StudentRecord WHERE " & GenderField & " ORDER BY " & SortField Else DBGrid1.Columns(0).Caption = " STUDENT Information" & vbCrLf & " Name, Guardian and Cell No." DBGrid1.Columns(1).Caption = " BILLING Information" & vbCrLf & " Year Period, Grade and Section" Field1 = "' ' + StudentRecord.LastName + ', ' + StudentRecord.FirstName + ' (' + StudentRecord.MiddleName + ') - ' + StudentRecord.Gender + Chr(10) + Chr(13) + ' Guardian: ' + StudentRecord.ParentName + Chr(10) + Chr(13) + ' Cell No.: ' + StudentRecord.ContactNo" Field2 = "' ' + TableOfBill.YearName + Chr(10)+ Chr(13) + ' ' + TableOfBill.GradeName + Chr(10)+ Chr(13) + ' ' + TableOfBill.SectionName" Field3 = "'' + Chr(10) + Chr(13) + Right(TableOfBill.YearName,9) + Chr(10) + Chr(13) + 'BILLING'" Field4 = "'' + Chr(10) + Chr(13) + 'STUDENT' + Chr(10) + Chr(13) + 'RECORD'" Field5 = "'' + Chr(10) + Chr(13) + Right(TableOfBill.YearName,9) + Chr(10) + Chr(13) + 'BILLING'" SortField = "StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, TableOfBill.YearName, TableOfBill.GradeName, TableOfBill.SectionName" If Combo1(0).ListIndex > 0 Then If Combo1(1).ListIndex > 0 Then If Combo1(2).ListIndex > 0 Then Data1.RecordSource = "SELECT DISTINCT " & Field1 & " as DataField1, " & Field2 & " as DataField2, " & Field3 & " as BillButton, " & Field4 & " as EditButton, " & Field5 & " as DeleteButton, StudentRecord.IDNo, StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, StudentRecord.ParentName, StudentRecord.ContactNo, StudentRecord.Gender, TableOfBill.YearName, TableOfBill.GradeName, TableOfBill.SectionName FROM TableOfBill RIGHT JOIN " _ & "StudentRecord ON TableOfBill.IDNo = StudentRecord.IDNo WHERE (Not IsNull(StudentRecord.IDNo)) And (TableOfBill.YearName='" & Trim(Combo1(0).Text) & "') And (TableOfBill.GradeName='" & Trim(Combo1(1).Text) & "') And (TableOfBill.SectionName='" & Trim(Combo1(2).Text) & "') And " & GenderField & " ORDER BY " & SortField Else Data1.RecordSource = "SELECT DISTINCT " & Field1 & " as DataField1, " & Field2 & " as DataField2, " & Field3 & " as BillButton," & Field4 & " as EditButton," & Field5 & " as DeleteButton, StudentRecord.IDNo, StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, StudentRecord.ParentName, StudentRecord.ContactNo, StudentRecord.Gender, TableOfBill.YearName, TableOfBill.GradeName, TableOfBill.SectionName FROM TableOfBill RIGHT JOIN StudentRecord ON TableOfBill.IDNo = StudentRecord.IDNo WHERE (Not IsNull(StudentRecord.IDNo)) And (TableOfBill.YearName='" & Trim(Combo1(0).Text) & "') And (TableOfBill.GradeName='" & Trim(Combo1(1).Text) & "') And " & GenderField & " ORDER BY " & SortField End If 'close our IF THEN ELSE statement using the END IF statement Else Data1.RecordSource = "SELECT DISTINCT " & Field1 & " as DataField1, " & Field2 & " as DataField2, " & Field3 & " as BillButton," & Field4 & " as EditButton, " & Field5 & " as DeleteButton, StudentRecord.IDNo, StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, StudentRecord.ParentName, StudentRecord.ContactNo, StudentRecord.Gender, TableOfBill.YearName, TableOfBill.GradeName, TableOfBill.SectionName FROM TableOfBill RIGHT JOIN StudentRecord ON TableOfBill.IDNo = StudentRecord.IDNo WHERE (Not IsNull(StudentRecord.IDNo)) And (TableOfBill.YearName='" & Trim(Combo1(0).Text) & "') And " & GenderField & " ORDER BY " & SortField End If 'close our IF THEN ELSE statement using the END IF statement Else Data1.RecordSource = "SELECT DISTINCT " & Field1 & " as DataField1, " & Field2 & " as DataField2, " & Field3 & " as BillButton," & Field4 & " as EditButton, " & Field5 & " as DeleteButton, StudentRecord.IDNo, StudentRecord.LastName, StudentRecord.FirstName, StudentRecord.MiddleName, StudentRecord.ParentName, StudentRecord.ContactNo, StudentRecord.Gender, TableOfBill.YearName, TableOfBill.GradeName, TableOfBill.SectionName FROM TableOfBill RIGHT JOIN StudentRecord ON TableOfBill.IDNo = StudentRecord.IDNo WHERE (Not IsNull(TableOfBill.IDNo)) And " & GenderField & " ORDER BY " & SortField End If 'close our IF THEN statement using the END IF statement End If 'close our IF THEN ELSE statement using the END IF statement Data1.Refresh If Data1.Recordset.RecordCount > 0 Then DBGrid1.Caption = String(Text3.Width \ 100, " ") & "Found " & Format(Data1.Recordset.RecordCount, "###,###,##0") & GenderFilter & "Record(s) in the Database..." Else DBGrid1.Caption = String(Text3.Width \ 100, " ") & "No" & GenderFilter & "Record is Found using the Current Filter..." End If 'close our IF THEN ELSE statement using the END IF statement DBGrid1.Enabled = True If FindIDNo <> "" Then: Data1.Recordset.FindFirst "IDNo = '" & FindIDNo & "'" If GridColIndex > 0 Then DBGrid1.SetFocus DBGrid1.Col = GridColIndex End If 'close our IF THEN statement using the END IF statement End Sub Private Sub CalculateBill(MonthNow As String) On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim PreviousBalance As Double Data2.Refresh PreviousBalance = 0 Do Until Data2.Recordset.EOF Data2.Recordset.Edit Data2.Recordset!BalanceBill = PreviousBalance Data2.Recordset!CurrentBill = Data2.Recordset!AmountFee + PreviousBalance Data2.Recordset.Update PreviousBalance = Data2.Recordset!CurrentBill - Data2.Recordset!PaidAmount Data2.Recordset.MoveNext Loop Data2.Refresh Data2.Recordset.FindFirst "Months >= DateValue('" & MonthNow & "')" End Sub Private Sub DisableControls() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point For Counter = 0 To 2 'using FOR NEXT LOOP statement using the variable COUNTER to loop 3 times starting from 0 to 2 Combo1(Counter).Enabled = False 'set the ENABLED property of object array named COMBO1, whose INDEX=the value of COUNTER, equal to FALSE Option3(Counter).Enabled = False 'set the ENABLED property of object array named OPTION3, whose INDEX=the value of COUNTER, equal to FALSE Next Counter 'loop adding 1 to the current value of Counter Command3(0).Enabled = False Check1.Enabled = False Text3.Enabled = False Text4.Enabled = False Frame3.Enabled = False DBGrid1.Enabled = False Option1(0).Enabled = False Option1(1).Enabled = False End Sub Private Sub EnableControls() On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim OptionIndex As Integer OptionIndex = IIf(Option1(0).Value = True, 0, 1) Option1(0).Enabled = True Option1(1).Enabled = True Option1(OptionIndex).Value = True Combo1(0).Enabled = True Combo1(1).Enabled = (Combo1(0).ListIndex > 0) Combo1(2).Enabled = (Combo1(1).ListIndex > 0) Option3(0).Enabled = True Option3(1).Enabled = True Option3(2).Enabled = True Command3(0).Enabled = True Command3(1).Visible = False Command3(2).Visible = False DBGrid2.Visible = False Check1.Enabled = True Text3.Enabled = True Text4.Enabled = True Frame2.Visible = False Frame3.Enabled = True DBGrid1.Enabled = True End Sub Function SendSMSMessage(Numberz As String, Messagez As String, APICodez As String) As String On Error Resume Next 'tell the compiler to just continue if errors are encountered from this point Dim Http As WinHttpRequest Dim StrURL As String Dim StrPostData As String Dim StrHeader As String Dim StrResponse As String StrPostData = "&1=" & Numberz & "&2=" & Messagez & "&3=" & APICodez StrURL = "https://www.itexmo.com/php_api/api.php" Set Http = New WinHttpRequest Http.Open "POST", StrURL, False Http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" Http.Send StrPostData StrResponse = Http.ResponseText Select Case StrResponse Case 1 SendSMSMessage = "Invalid Number." Case 2 SendSMSMessage = "Number prefix not supported. Please" & vbCrLf & "contact SMS Server so we can add the prefix." Case 3 SendSMSMessage = "Invalid SMS Server Code." Case 4 SendSMSMessage = "Maximum Message per day reached." Case 5 SendSMSMessage = "Maximum allowed characters for message reached." Case 6 SendSMSMessage = "SMS Server is Offline." Case 7 SendSMSMessage = "Expired SMS Server Code." Case 8 SendSMSMessage = "SMS Server Error. Please try again later." Case 9 SendSMSMessage = "Invalid Function Parameters." Case 10 SendSMSMessage = "Recipient's number is blocked" & vbCrLf & "due to FLOODING, message was ignored." Case 11 SendSMSMessage = "Recipient's number is blocked temporarily" & vbCrLf & "due to HARD sending (after 3 retries of" & vbCrLf & "sending and message still failed to send)" & vbCrLf & "and the message was ignored. Try again after an hour." Case 12 SendSMSMessage = "Invalid request. You can't set message" & vbCrLf & "priorities on NON-Corporate SMS Server Codes." Case 13 SendSMSMessage = "Invalid or Not Registered Custom Sender ID." Case 0 SendSMSMessage = "Success! SMS Message is now on queue and" & vbCrLf & "will be sent as soon as possible by SMS Server." Case Else SendSMSMessage = "SMS Server is not Available." End Select 'close our SELECT CASE statement using the END SELECT statement End Function